#include "BaseDlg.h"
#include <qevent.h>

BaseDlg::BaseDlg(QWidget* parent /*= nullptr*/, const QString& title /*= "BaseDlg"*/, bool isRoot /*= true*/)
	:
	BaseWindow{}
{
	if (isRoot)
	{
		base_ui.setupUi(this);
		base_ui.lab_title->setText(title);
		this->setWindowFlags(Qt::FramelessWindowHint);
		setAttribute(Qt::WA_TranslucentBackground);
		connect(base_ui.btn_close, &QPushButton::clicked, this, &BaseDlg::reject);
		connect(base_ui.buttonNo, &QPushButton::clicked, this, &BaseDlg::reject);
		connect(base_ui.buttonYes, &QPushButton::clicked, this, &BaseDlg::accept);
	}
}

BaseDlg::~BaseDlg()
{
}

bool BaseDlg::showDialog()
{
	this->exec();
	return this->result() == DialogCode::Accepted;
}

void BaseDlg::_setupUi()
{
	this->base_ui.content->addWidget(&content_view);
}